<?php

function elements_get_color_schemes_list() {
    $theme_info = Owl_Theme_Control::load_setting(Owl_Theme_Control::get_current_theme());
    $color_schemes = $theme_info["color_schemes"];
    $list = array();
    foreach ($color_schemes as $color_scheme) {
        $string = '<form action="' . Owl_Link::current_theme_url(false) . 'elements-ajax.php' . '" method="POST">';
        $string .= Owl_Form::print_hidden(array(
            "name" => "action",
            "value" => "change_color",
            "toString" => true
        ));
        $string .= Owl_Form::print_hidden(array(
            "name" => "color",
            "value" => $color_scheme["scheme_class"],
            "toString" => true
        ));
        $string .= '<a href="#" class="elements-change-color to-' . $color_scheme["scheme_class"]. '"><span>' . $color_scheme["scheme_name"] . '</span></a>';
        $string .= '</form>';
        $list[] = $string;
    }
    Owl_Form::print_hidden(array(
        "name" => "elements_current_color",
        "value" => ($_SESSION["user"]["body_class"] == false) ? get_option('current_body_class') : $_SESSION["user"]["body_class"],
    ));
    echo Owl_Html::make_it_list($list);
}

function elements_print_body_class() {
    if ($_SESSION["user"]["body_class"] == false) {
        return Owl_Theme_Control::print_body_class();
    }
    else {
        return Owl_Functions::print_css_namespace($_SESSION["user"]["body_class"]);
    }
}

enqueue_script('form');

register_sidebar(array('name' => 'vertical-sidebar',
                       'before_widget' => '<div class="widget">',
                       'after_widget' => '</div>',
                       'before_title' => '<div class="widget-header">',
                       'after_title' => '</div>',
                       'before_content'=>'<div class="widget-content">',
                       'after_content'=>'</div>'
                ));
register_sidebar(array('name' => 'horizontal-sidebar-1',
                       'before_widget' => '<div class="widget">',
                       'after_widget' => '</div>',
                       'before_title' => '<div class="widget-header">',
                       'after_title' => '</div>',
                       'before_content'=>'<div class="widget-content">',
                       'after_content'=>'</div>'
                ));
register_sidebar(array('name' => 'horizontal-sidebar-2',
                       'before_widget' => '<div class="widget">',
                       'after_widget' => '</div>',
                       'before_title' => '<div class="widget-header">',
                       'after_title' => '</div>',
                       'before_content'=>'<div class="widget-content">',
                       'after_content'=>'</div>'
                ));
register_sidebar(array('name' => 'horizontal-sidebar-3',
                       'before_widget' => '<div class="widget">',
                       'after_widget' => '</div>',
                       'before_title' => '<div class="widget-header">',
                       'after_title' => '</div>',
                       'before_content'=>'<div class="widget-content">',
                       'after_content'=>'</div>'
                ));
register_sidebar(array('name' => 'horizontal-sidebar-4',
                       'before_widget' => '<div class="widget">',
                       'after_widget' => '</div>',
                       'before_title' => '<div class="widget-header">',
                       'after_title' => '</div>',
                       'before_content'=>'<div class="widget-content">',
                       'after_content'=>'</div>'
                ));